home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / MacX25 / MacX25 Developer's Kit / MacX25_Interfaces / CIncludes / ServerAgent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-21  |  10.4 KB  |  261 lines  |  [TEXT/MPS ]

  1. # ifndef __SERVER_AGENT__
  2. # define __SERVER_AGENT__
  3. /*
  4.  *    File -    ServerAgent.h
  5.  *            Defines for Server Agent access across the NuBus
  6.  *
  7.  *
  8.  *    Copyright Apple Computer, Inc. 1987, 1988, 1989, 1990
  9.  *    All Rights Reserved.
  10.  *
  11.  *    Apple Need to Know Confidential
  12.  *
  13.  *    Jim Christy, Rick Holzgrafe, Scott Leahy, Tom Robertson, Dave Willey
  14.  *
  15.  *    Change Log:
  16.  *    
  17.  *    11.13.90    JEC        • Added Change Log.
  18.  *                        • Updated security and copyright notices.
  19.  *                        • added defines for ClientNote reliablity.
  20.  *
  21.  */
  22.  
  23. #include <X25_System.h>
  24.  
  25. /*
  26.  * Message codes (mCode)
  27.  *
  28.  * mCodes 0x120 thru 0x13F and 0x150 thru 0x17F,
  29.  * are for use between Servers and the server agent,
  30.  * and should not be used for any other purpose.
  31.  *
  32.  * mCodes 0x180 thru 0x20F are for use between Authenticators and the server agent,
  33.  * and should not be used for any other purpose.
  34.  *
  35.  */
  36.  
  37. #define LMSon            0x120        /* client application enables LMS                    */
  38. #define AckLMSon        0x121
  39.  
  40. /*    Subcodes for tracing in mOData [0]    */
  41.  
  42. #define LMSFrameTraceON        0
  43. #define LMSFrameTraceOFF    1
  44. #define LMSPacketTraceON    2
  45. #define LMSPacketTraceOFF    3
  46.  
  47. #define LMSoff            0x122        /* client application disables LMS                    */
  48. #define AckLMSoff        0x123
  49. #define LMSData            0x124        /* server sends LMS output to client                */
  50. #define AckLMSData        0x125
  51. #define    UserData        0x12c        /* user data to network server                      */
  52. #define AckUserData        0x12d        /* server acknowledgement of user data                 */
  53. #define NetWrkData        0x12e        /* data passed from the network server to the user     */
  54. #define AckNetData        0x12f        /* acknowledgement of network data                     */
  55. #define ServerReg        0x132        /* network server for registration                     */
  56. #define SvrRegAck        0x133        /* server registration acknowledgement                 */
  57. #define CheckCard        0x134        /* tickle packet to test if card is still alive        */
  58. #define ChkCardAck        0x135        /* ack from live card                                */
  59. #define CktShtDwn        0x136        /* shut down circuit after all data is sent            */
  60. /* CKtSHtDwn is not acked, so 0x137 is not used                                            */
  61.  
  62. /* mCodes 138-14f reserved for server's internal use                                    */
  63.  
  64. #define ServerDeReg        0x150        /* network server de-registry                        */
  65. #define SvrDRegAck        0x151        /* network server de-registry acknowledgment        */
  66. #define CktAbort        0x152        /* shut down circuit with possible loss of data        */
  67. /* CktAbort is not acked, so 0x153 is not used                                            */
  68. #define OpenReq            0x154        /* agent requests new circuit                        */
  69. #define OpenReqAck        0x155        /* new circuit request acknowledgment                */
  70. #define UserIData        0x156        /* incomplete user data to network server            */
  71. #define AckUserIData    0x157        /* server acknowledgement of incomplete user data    */
  72. #define NetIData        0x158        /* incomplete data from network server to the user     */
  73. #define AckNetIData        0x159        /* acknowledgement of incomplete network data         */
  74.  
  75. #define Claim            0x180        /* Authenticator claims a server                    */
  76. #define ClaimAck        0x181        /* Server Agent acknowledges Claim                    */
  77. #define QuitClaim        0x182        /* Authenticator disclaims a server                    */
  78. #define QuitClaimAck    0x183        /* Server Agent acknowledges QuitClaim                */
  79. #define StatusReq        0x184        /* Server Agent requests status from Authenticator    */
  80. #define StatusReqAck    0x185        /* Authenticator acknowledges StatusReq                */
  81. #define Validate        0x186        /* Server Agent requests password validation        */
  82. #define ValidateAck        0x187        /* Authenticator acknowledges Validate                */
  83. #define DeathNote        0x188        /* Server Agent sends death notification            */
  84. #define DeathNoteAck    0x189        /* Authenticator acknowledges DeathNote                */
  85. #define LOGINNOTE        0x18A        /* Server Agent sends login notification            */
  86. #define LOGINNOTEACK    0x18B        /* Authenticator acknowledges DeathNote                */
  87. #define LogoutNote        0x18C        /* Server Agent sends logout notification            */
  88. #define LogoutNoteAck    0x18D        /* Authenticator acknowledges DeathNote                */
  89. #define BBEListReq        0x18E        /* Server Agent requests Black Book Entry list        */
  90. #define BBEListReqAck    0x18F        /* Authenticator acks Black Book Entry list req        */
  91. #define BBEList            0x190        /* Authenticator sends Black Book Entry list        */
  92. #define BBEListAck        0x191        /* Server Agent acks Black Book Entry list            */
  93. #define BBGetEntry        0x192        /* Server Agent requests Black Book Entry             */
  94. #define BBGetEntryAck    0x193        /* Authenticator acks Black Book Entry  req            */
  95. #define BBEntry            0x194        /* Authenticator sends Black Book Entry             */
  96. #define BBEntryAck        0x195        /* Server Agent acks Black Book Entry                  */
  97. #define ClientNote        0x196        /* Message to be passed to a client                    */
  98. #define ClientNoteAck    0x197        /* Server Agent acks ClientNote                        */
  99.  
  100. /*
  101.  * mStatus values (for least significant byte of mStatus) for error returns
  102.  * 0x00 is "OK"
  103.  * 0x01 - 0x1F reserved for Agent-Server or Server-Agent replies
  104.  * 0x20 - 0x3F reserved for Agent-Authenticator or Authenticator-Agent replies
  105.  *                (These are also used in status field of ADSP login protocol messages)
  106.  */
  107. /* OS_UNKNOWN_MESSAGE is defined in MR-DOS managers.h, and means "unrecognized mCode"    */
  108. #define SAE_OK                0x00    /* "All's Well"                                        */
  109.  
  110. #define SAE_NULL_DATA        0x01    /* mDataPtr is NULL, and shouldn't be                */
  111. #define SAE_ZERO_DATA        0x02    /* mDataSize is zero, and shouldn't be                */
  112. #define SAE_VCID_UNKNOWN    0x03    /* VCID (in mOData[0]) is not recognized            */
  113. #define SAE_DUP_REG         0x04    /* ServerReg fails: name and type already in use    */
  114. #define SAE_NO_ROOM         0x05    /* ServerReg fails: too many servers already registered */
  115. #define SAE_BAD_NAME         0x06    /* ServerReg fails: name or type too long            */
  116. #define SAE_PRI_OVERFLOW    0x07    /* Priority message too long: it was sent but was    */
  117.                                     /*    truncated to the maximum allowable length        */
  118.  
  119. #define SAE_SRVR_UNKNOWN    0x20    /* On any reply: unknown server                        */
  120. #define SAE_DUP_CLAIM        0x21    /* Claim or QuitClaim fails: server already claimed    */
  121. #define SAE_BAD_PASS        0x22    /* Validation fails: password is incorrect            */
  122. #define SAE_USER_UNKNOWN    0x23    /* Validation fails: username not recognized        */
  123. #define SAE_PASS_NO_CHANGE    0x24    /* Validation succeeds, but password change fails    */
  124.  
  125. #define SAE_NO_AUTHENT        0x26    /* No Authenticator available for this Server        */
  126. #define SAE_BAD_METHOD        0x27    /* Authentication method not permitted                */
  127. #define SAE_BAD_MESSAGE        0x28    /* Message format incorrect or unexpected            */
  128. #define SAE_NOT_NOW            0x29    /* Authenticator refuses all logins categorically    */
  129.  
  130.  
  131. #define LME_BufferTooLarge    0x30    /* data buffer exceeds LMS input size                */
  132. #define LME_LMSBusy            0x31    /* LMS unable to process command since it is busy    */
  133.  
  134. /*
  135.  * Object and Type of the Server Agent as registered with MR-DOS Name Manager
  136.  */
  137. #define AgentName        "ADSP Agent"    /* Agent's Registered Object name                 */
  138. #define AgentType        "Server Agent"    /* Agent's Registered Type                         */
  139.  
  140.  
  141. /*
  142.  * Message priority
  143.  * MR-DOS messages with mPriority >= SA_PRIORITY are treated
  144.  * as priority messages; others are ordinary messages.
  145.  */
  146. # define SA_PRIORITY    ((unsigned short)0x8000)
  147.  
  148.  
  149. /*
  150.  * Data Structures for the Login protocol between Server Agent and Client,
  151.  * carried over ADSP. Each message must be followed by ADSP end-of-message flag.
  152.  */
  153.  
  154. #define SAC_MSG_VERSION        0x01    /* Message version number                            */
  155.  
  156. #define PASS_SZ        8    /* Passwords and tokens are this many bytes long.                */
  157.                         /* Shorter passwords are padded on the right with NULLs            */
  158.  
  159. /*
  160.  * Values for msgType fields.
  161.  * Values 0-127 are reserved for Server Agent;
  162.  * high bit is reserved for error returns;
  163.  * values 128-32767 are available for arbitrary use by users.
  164.  */
  165. typedef short SAC_msgType;
  166.  
  167. /* Login messages        */
  168. #define serviceReq        1
  169. #define loginPrompt        2
  170. #define loginReq        3
  171. #define loginReply        4
  172. /* Black Book messages    */
  173. #define listReq            5
  174. #define listReply        6
  175. #define entryReq        7
  176. #define entryReply        8
  177.  
  178.  
  179. /*
  180.  * Values for serviceKind field of serviceReqMsg
  181.  */
  182. typedef enum
  183.     {
  184.     connectToServer, verifyPassword, getLoginMethods, getAddresses
  185.     } SAC_serviceType;
  186.  
  187. /*
  188.  * Access method and other bit flags.
  189.  * These are used both in the ADSP messages to and from the Client,
  190.  * and in the MR-DOS messages to and from the Authenticator, during Authentication.
  191.  * Not all flags are meaningful in every message.
  192.  */
  193. typedef struct
  194.     {
  195.     unsigned        guestOK        :1;    /* Guest login permitted                            */
  196.     unsigned        registerOK    :1;    /* Registered user login permitted                    */
  197.     unsigned        DES_OK        :1;    /* DES-encrypted passwords permitted                */
  198.     unsigned        clearOK        :1;    /* Cleartext passwords permitted                    */
  199.     unsigned        changeOK    :1;    /* User may change password                            */
  200.     unsigned        deathNote    :1;    /* Authenticator requests death notification        */
  201.     unsigned        freeAccess    :1;    /* Authenticator allows login-less access to Server    */
  202.     unsigned        loginNote    :1;    /* Authenticator requests log in/out notification    */
  203.     unsigned        doBlackBook    :1;    /* Authenticator accepts Black Book requests        */
  204.     unsigned        reserved    :7;    /* Reserved for future use                            */
  205.     } accessBits;
  206.  
  207. /*
  208.  * Definitions of the four Agent-Client login protocol messages carried over ADSP.
  209.  */
  210. typedef struct
  211.     {
  212.     _X25_common_header    cmn_hdr;
  213.     SAC_msgType        msgType;        /* Always serviceReq                                */
  214.     char            msgVersion;        /* Always SAC_MSG_VERSION                            */
  215.     SAC_serviceType    serviceKind;    /* Kind of service requested                        */
  216.     } serviceReqMsg;
  217.         
  218. typedef struct
  219.     {
  220.     _X25_common_header    cmn_hdr;
  221.     SAC_msgType        msgType;        /* One of loginPrompt, loginReq, or loginReply        */
  222.     
  223.     char            msgVersion;        /* Always SAC_MSG_VERSION                            */
  224.     
  225.     char            status;            /* For loginPrompt and loginReply:                    */
  226.                                     /*        SAE_OK, or error                            */
  227.                                     /* For loginReq:                                    */
  228.                                     /*        Unused                                        */
  229.     
  230.     accessBits        access;            /* For loginPrompt and loginReply:                    */
  231.                                     /*                 Login methods permitted                */
  232.                                     /* For loginReq:                                    */
  233.                                     /*                 Login method being used                */
  234.  
  235.     char            pass1[PASS_SZ];    /* For loginPrompt and loginReply:                    */
  236.                                     /*     Token for DES-encoding                            */
  237.                                     /* For loginReq:                                    */
  238.                                     /*     Current password, either clear or DES-encoded    */
  239.  
  240.     char            pass2[PASS_SZ];    /* For loginReq:                                    */
  241.                                     /*     New password, in clear, for changing password    */
  242.                                     /* For loginPrompt and loginReply:                    */
  243.                                     /*    Unused                                            */
  244.                                     
  245.     char            stringData[0];    /* For loginPrompt:                                    */
  246.                                     /*         Pascal string: Server Agent version string    */
  247.                                     /* For loginReq:                                    */
  248.                                     /*         Pascal string: User's Name                    */
  249.                                     /* For loginReply:                                    */
  250.                                     /*        Unused                                        */
  251.     } loginMsg;
  252.  
  253. /* used in ClientNote messages in the mOData[2] filed of the AROSE message to denote    */ 
  254. /* reliablity requirements for the Client Notice.                                        */
  255.  
  256. #define RELIABLE    0L // used when sending shutdown warning messages
  257. #define UNRELIABLE  7L
  258.  
  259. # endif  __SERVER_AGENT__
  260.  
  261.